﻿using System;
using System.ComponentModel;
using System.Data;
using System.Windows;
using WPFExcelReport.Helpers;
using ReflectionStudio.Core.Events;
namespace WPFExcelReport
{
    public partial class UIVVAVIS : ViewBase
    {
        public UIVVAVIS()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
        }

        public override void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            if (IsLoaded)
                return;
            base.Window_Loaded(sender, e);
        }

        public override void vwMaster_CurrentChanged(object sender, System.EventArgs e)
        {
            base.vwMaster_CurrentChanged(sender, e);
            if (dwMaster == null)
            {
                KEY = "";
                FAHRER = "";
            }
            else
            {
                KEY = dwMaster["VVAAVISNR"].ToString();
                FAHRER = dwMaster["VVAFAHRER"].ToString();
            }
        } 
     
     
        public void Insert(DataRow _dwVVA)
        {
            ((VVVAVIS)MV).InsertVVAVIS(_dwVVA, app.company);
            TBMain.Rows.InsertAt(_dwVVA, 0);
          

        } 
        
        public virtual void OnSARTChg(string value)
        {
 
        }
        
        public virtual void OnVSPEDChg(string value)
        {
             
        }

        public virtual void OnSHIPWAYChg(string value)
        {
        }

        public virtual void OnAVISNRChg(string value)
        {
        }
        public virtual void OnLIEFSCHChg(string value)
        {
        }

        public virtual void OnFAHRERChg(string value)
        {
        }
    }
    public partial class UIVVAVIS : ViewBase
    {
        public VVVAVIS TMV
        {
            get
            {
                return (VVVAVIS)MV;
            }
        }

        #region ==SART===========
        public static readonly DependencyProperty SARTProperty = DependencyProperty.Register("SART",
            typeof(string), typeof(UIVVAVIS),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnSARTChanged));
        public string SART
        {
            get
            {
                return (string)GetValue(SARTProperty);
            }
            set
            {
                SetValue(SARTProperty, value);
                OnSARTChg(value);
            }
        }
        private static void OnSARTChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIVVAVIS;
            if (src != null)
            {
                src.SART = (string)e.NewValue;
            }
        }
        #endregion

        #region ==VSPED===========
        public static readonly DependencyProperty VSPEDProperty = DependencyProperty.Register("VSPED",
            typeof(string), typeof(UIVVAVIS),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnVSPEDChanged));
        public string VSPED
        {
            get
            {
                return (string)GetValue(VSPEDProperty);
            }
            set
            {
                SetValue(VSPEDProperty, value);
                OnVSPEDChg(value);
            }
        }
        private static void OnVSPEDChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIVVAVIS;
            if (src != null)
            {
                src.VSPED = (string)e.NewValue;
            }
        }
        #endregion

        #region ==SHIPWAY===========
        public static readonly DependencyProperty SHIPWAYProperty = DependencyProperty.Register("SHIPWAY",
            typeof(string), typeof(UIVVAVIS),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnSHIPWAYChanged));
        public string SHIPWAY
        {
            get
            {
                return (string)GetValue(SHIPWAYProperty);
            }
            set
            {
                SetValue(SHIPWAYProperty, value);
                OnSHIPWAYChg(value);
            }
        }
        private static void OnSHIPWAYChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIVVAVIS;
            if (src != null)
            {
                src.SHIPWAY = (string)e.NewValue;
            }
        }
        #endregion


        #region ==AVISNR===========
        public static readonly DependencyProperty AVISNRProperty = DependencyProperty.Register("AVISNR",
            typeof(string), typeof(UIVVAVIS),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAVISNRChanged));
        public string AVISNR
        {
            get
            {
                return (string)GetValue(AVISNRProperty);
            }
            set
            {
                SetValue(AVISNRProperty, value);
                OnAVISNRChg(value);
            }
        }
        private static void OnAVISNRChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIVVAVIS;
            if (src != null)
            {
                src.AVISNR = (string)e.NewValue;
            }
        }
        #endregion         

        #region ==LIEFSCH===========
        public static readonly DependencyProperty LIEFSCHProperty = DependencyProperty.Register("LIEFSCH",
            typeof(string), typeof(UIVVAVIS),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnLIEFSCHChanged));
        public string LIEFSCH
        {
            get
            {
                return (string)GetValue(LIEFSCHProperty);
            }
            set
            {
                SetValue(LIEFSCHProperty, value);
                OnLIEFSCHChg(value);
            }
        }
        private static void OnLIEFSCHChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIVVAVIS;
            if (src != null)
            {
                src.LIEFSCH = (string)e.NewValue;
            }
        }
        #endregion

        #region ==FAHRER===========
        public static readonly DependencyProperty FAHRERProperty = DependencyProperty.Register("FAHRER",
            typeof(string), typeof(UIVVAVIS),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnFAHRERChanged));
        public string FAHRER
        {
            get
            {
                return (string)GetValue(FAHRERProperty);
            }
            set
            {
                SetValue(FAHRERProperty, value);
                OnFAHRERChg(value);
            }
        }
        private static void OnFAHRERChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIVVAVIS;
            if (src != null)
            {
                src.FAHRER = (string)e.NewValue;
            }
        }
        #endregion
    }
}